package org.zhuyx.ch02.shili.aop;

import org.aspectj.lang.JoinPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;

/**
 * @author 茜茜
 * @date 2024-12-06 15:09
 */
public class LoggerAspect {
    private static final Logger log =  LoggerFactory.getLogger(LoggerAspect.class);
    public void before(JoinPoint jp){
        log.info("【LoggerAspect前置增强】正在调用{}的{}方法。方法入参:{}",jp.getTarget(),jp.getSignature().getName(), Arrays.toString(jp.getArgs()));
    }
    public void afterReturning(JoinPoint jp,Object result){
        log.info("【LoggerAspect后置增强】{}的{}方法正常返回,返回值：{}",jp.getTarget(),jp.getSignature().getName(), result);
    }
}
